﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entities.Admin;

namespace BLL.Admin
{
    public class QuanLiTaiKhoan
    {
        public static bool KiemTra(string s, List<TaiKhoan> ds)
        {
           
            
            foreach (var item in ds)
                if (item.MaNhanVien.ToLower().Equals(s.ToLower()))
                    return true;
            return false;

        }
        public static List<TaiKhoan> SapTangTheoUsername(List<TaiKhoan> ds)
        {
            ds.Sort(delegate(TaiKhoan o, TaiKhoan b)
                {
                    return o.UserName.CompareTo(b.UserName);
                });
            return ds;
        }
        public static List<TaiKhoan> SapGiamTheoUsername(List<TaiKhoan> ds)
        {
            ds.Sort(delegate(TaiKhoan o, TaiKhoan b)
            {
                return -o.UserName.CompareTo(b.UserName);
            });
            return ds;
        }
        public static bool KiemTraDuyNhat(string manv, int magiai,List<TaiKhoan>tk)
        {
            foreach (var item in tk)
                if (item.MaNhanVien.Trim().ToUpper() == manv && item.MaGiaiDau == magiai)
                    return true;
            return false;

           
        }
        public static bool KiemTraMa(string s, List<TaiKhoan> ds)
        {
            foreach (var item in ds)
                if (item.UserName.ToLower().Equals(s.ToLower()))
                    return true;
            return false;

        }
    }
    

}
